package cn.rhl.projectinit.exception;

import cn.rhl.projectinit.common.ResponseCode;
import lombok.Getter;

/**
 * @author rhl
 * @date 2024/12/22
 */
@Getter
public class BusinessException extends RuntimeException {

    /**
     * 响应码
     */
    private final String code;

    public BusinessException(String code, String msg) {
        super(msg);
        this.code = code;
    }

    public BusinessException(ResponseCode responseCode) {
        super(responseCode.getMessage());
        this.code = responseCode.getCode();
    }

    public BusinessException(ResponseCode responseCode, String msg) {
        super(msg);
        this.code = responseCode.getCode();
    }
}
